Use of yield keyword in Python